LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-11-2009, 03:00 AM   #1
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Rep: Reputation: 33
stupid mistake js


Hi folks, i have tons of js in my various websites. this thing is defeating me

what the heck am i doing wrong?

it doesn't show the alert box.

Code:
----in head ---
<script>

function getres();
{
  if(document.all) { //ie
    var win_w = window.document.body.clientWidth;
    var win_h = window.document.body.clientHeight;
  }
  if(document.layers) { //netscape
    var win_w = window.innerWidth;
    var win_h = window.innerHeight;
  }
  if(document.all || document.layers) {
    var scr_w = window.screen.width;
    var scr_h = window.screen.height;
  }
  var res = "Resolution : " + scr_w + " x " + scr_h;
  var iwin = "Inner win  : " + win_w + " x " + win_h;
  alert (res + "\n" + iwin);
}
</script>

----------------------------------
in body
<script>
  getres();
</script>
 
Old 10-11-2009, 06:04 AM   #2
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
fixed it

I'd put it after <script src="/resizing_background.js">
which it didn't like!

Code:
<head>
<script type="text/javascript" id="sothink_dhtmlmenu"> <!--
  function jsh()
  {

    var win_w = window.document.body.clientWidth;
    var win_h = window.document.body.clientHeight;

    var iwin_w = window.innerWidth;
    var iwin_h = window.innerHeight;
  
    var scr_w = window.screen.width;
    var scr_h = window.screen.height;
 

    var res = "Resolution : " + scr_w + " x " + scr_h;
    var win = "      win  : " + win_w + " x " + win_h;
    var iwin = "Inner win  : " + iwin_w + " x " + iwin_h;
    alert (res +"\n" + win + "\n" +iwin);
}

function platform()
{
  alert(navigator.platform);
}
//--> </script>



  <script src="/resizing_background.js">
  </script>
  <script type="text/javascript" id="sothink_dhtmlmenu"> <!--
 st_siteroot="/";
 st_jspath="/js/stmenu.js";
 if(!window.location.href.indexOf("file:") && st_jspath.charAt(0)=="/")
  document.write('<script type="text/javascript" src="'+st_siteroot+st_jspath+'"><\/script>');
 else 
  document.write('<script type="text/javascript" src="'+st_jspath+'"><\/script>');
//--> </script>
</head>
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
stupid noob mistake, deleted grub tylerrrrrrr Linux - Newbie 8 03-13-2009 03:56 PM
Stupid newbie mistake, now lsmod shows nothing.... Romanus81 Slackware 3 04-20-2008 08:41 PM
Dual boot problem because of stupid mistake randomguy Linux - General 1 08-26-2006 11:03 AM
Big stupid Bad Mistake... GRUB dasz Linux - Software 7 12-09-2004 09:35 AM
Stupid Mistake, WPC54G, not WPC11 Rv5 Red Hat 1 09-02-2003 01:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration