I am working a project where I am using two monitors and using HTML/Javascript to display the information I want.
I have my main stuff on the main monitor, but when each page loads, I want an image to load fullscreen on the second monitor as well. I am using 800x600 resoution on both.
If I use:
function openWindow() { mainWindow = window.open("thispage.htm","pagename","fullscreen=yes"); }
that works fine for the main monitor.
I have then tried to use the second monitor to open an image by using the same type of thing:
function imageWindow() { openImage = window.open("image.jpg","imagepage","fullscreen=yes"); openImage.moveTo(801,0); parent.focus(); }
I am trying to use it with the onload command as well:
<body onLoad="imageWindow();">
I am passing arguments to these functions but simplified it here.
Anyhow it will only open it full screen on the first monitor. I can position it and move it to the second monitor if it is not full screen just fine.
I am developing a website in which I will support two screen resolutions ( 800X600 & 1024X768 ) by using two different stylesheets for better browsing experience. I need a code to detect resolution and then putting the desired stylesheet in page code at request time. If there is any server side language to be used with it then I can use PHP.
I have a site up and running called www.kalahari.co.za which points to www.kalahari-adventures.co.za As the business depends on adventurous people seeing images of the place, the bigger the better. So I have designed the site to show one static background pic to each page. I sorted out a problem of different browsers by have a hidden index page that looks at the monitor a viewer has and decides that if you have a 1024 x 768 monitor it then opens a page index1024.htm that has the appropriately sized background pic.
Now I said to my client he would get better search engine ratings if we created 3 sites and the existing site is spread over those sites. Anyway I have done all that only to discover from High Rankings Advisor (highrankings.com that search engines have now cottoned onto this (competitors complaining I suppose). But I'm going ahead anyway.
My problem is that I have put all my keywords and descriptions on the 1024 pages. But if a person sees that page in a search engine clickt to view it and has a 800 x 600 monitor then my script is not going to work.
I have tried putting my index page script onto all the pages (see script below), but when I open a unique page it looks for the index page in the folder where that doc is situated. I suppose a quick and dirty would be to direct the viewer back to the index page which will then activates the scrpt (see below) that checks for the right monitor size.
I would prefer the viewer to stay on page. So If someone who knows Javascript can rewrite the script so that A) it looks at the name of the page. And B) once it sees that page's name it has to then look for that same page in the appropriate folder and open that page. (folders are docs800, docs1024 and docs1624)
The problem is that I can't have the same index page script because at the moment if the script is on the page I am trying to open, it loops forever.
How do I sort this out?
This is the present script on the index page.
<script language="JavaScript"> <!--// hide bad old browsers var s800x600page = "index800.htm"; var s1024x768page = "index1024.htm"; var s1152x864page = "index1264.htm"; var s1280x720page = "index1264.htm"; var s1280x960page = "index1264.htm"; var s1280x1024page = "index1264.htm"; var pagetype; if ((screen.height == 600) && (screen.width == 800)) { pagetype = 2; } else if ((screen.height == 768) && (screen.width == 1024)) { pagetype = 3; } else if ((screen.height == 864) && (screen.width == 1152)) { pagetype = 4; } else if ((screen.height == 720) && (screen.width == 1280)) { pagetype = 4; } else if ((screen.height == 960) && (screen.width == 1280)) { pagetype = 4; } else if ((screen.height == 1024) && (screen.width == 1280)) { pagetype = 4; } else { pagetype = 2; } if (pagetype == 2) { window.location.href = s800x600page } else if (pagetype == 3) { window.location.href = s1024x768page } else if (pagetype == 4) { window.location.href = s1152x864page } else if (pagetype == 4) { window.location.href = s1280x720page } else if (pagetype == 4) { window.location.href = s1280x960page } else if (pagetype == 4) { window.location.href = s1280x1024page } //--> </script>
I design but programming is still in my dreams ...
I am running client (browser) side Javascript, and would like to somehow be able to detect whether some Javascript code causes any changes to occur to the DOM model.
Is there any way to do this? For example, with some kind of try/catch block?
Is there a way to monitor a newly opepend child window with opener, even when the page keeps reloading ?
Say window A opens window B and gives it a name/handle "myWindow". At this point anywhere in window A, we could say myWindow.location.href to find out where the child is.
But what if someone was to take window A to another site, and than return using history button, OR reload it completely.
upon load the var myWindow would get executed again, and it seems like the handle would be lost. I tried to see if there was a window.children collection that might still hold window B in its subset, but was not able to find a way thus far.
I am interested in using RaphaelJS for creating VML/SVG rounded corners etc, but unless i physically put the <script> right after the element to which it needs to be applied, i have to rely on the single DOM load() event. which causes a delay before any script is executed,...thus a FOUC (flash of unstyled content).
i'm guessing there is no way to track when individual elements are loaded into the DOM via a CSS filter or similar, or another way around this other than having <script> in the body or just dealing the the load delay?
I want to make a custom visitor tracking tool and like Google Analytics it must be able to track how long time visitors spend on each page.How do you recommend doing this?I thought of using the Javascript onload event to start counting time serverside and then the onbeforeunload event to do tell the server to end the time count. I'm just skeptic of an infinite visit duration if the visitor's browser for some reason doesn't call the event (ie power outage).
.change() is only for form elements minus check boxes/radio buttons, etc.Are any of you aware of a script that does this already? Hopefully one that is easy to implement.I just want to monitor things like height, number of inner elements, or any change in the inner HTML.
I have a web form with several fields. If I copy & paste from a RTF document into a field, the javascript validation and field length are bypassed and cause the form to fail.
I am trying to make a form for my friends to fill in which will calculate their average score. Currently my script body is something like this Code:
<HTML> <HEAD> <TITLE>Lab 1</TITLE> </HEAD>
<BODY bgcolor="C0C0C0"> <SCRIPT language="JavaScript"> <!-- alert("Please enter your scores. Thank You.") var english = ?? var maths = ?? var geography = ?? var chinese = ?? var lit = ?? var psci = ?? var lsci = ?? var art = ?? var hist = ?? var mep = ?? var total = english + maths + geography + chinese + lit + psci + lsci + art + hist + mep var subjects = 10 document.write("Your average is " + total / + subjects) //--> </SCRIPT> </BODY> </HTML>
So what I was thinking was is it possible to make a form that will fill in the variables after they have typed it in and click ok, the variables will the be added and calculated to give the average.
I am trying to make a trivia game for a project that i'm doing, and i'm having some troubles. I have 5 questions stored in arrays, the 5 answers stored in a different array and those 5 answers wrote out in another array. I have 5 text boxes, one displaying the questions and the other 4 displaying the multiple choices. I also have 4 submit buttons, one for a, b, c and d. Now i just need to make sure that the answer the user picks is the right one. I was thinking, if there was a way to tell which submit box is clicked, that i would do something along that line, but if any one has a better way to do it then cool. Here's my code:
I wish to carry out standard form validation (i.e. is it a date?, is there a value in the field, is it a number) using the onBlur event rather than the onSubmit event. This (of course) leads to problems when cancelling an edit as leaving a field to press the cancel button will trigger the onBlur event and therefore the field validation. Is there any way to know the destination field / button that caused the onBlur event? In Ingres ABF/W4GL (mid eighties language of similar functionality to javascript) there was an available attribute called the targetfield so the code could run...
onBlur myfield = { if (targetfield != CancelButton) { carry out validation } }
Is there something similar in javascript or will I have to program round the houses i.e. onBlur records which validation to run and onFocus runs the validation (unless it's a cancel button)?
I want a customized button with an image for the submit button, and when the submit button has been clicked send the form to the perl script.
Now the form is no problem but the button is, so the question is how do I create a custom button and how do I submit the form with javascript when the button is clicked?
Is it possible to use JavaScript to apply different actions to a form depending on a value within the form (eg sending form data to different cgi scripts depending which radio button is checked)?
Basically I want the document.write(document.applets[0].getLHost()); to display as the value in the form field. But when I try this it literally displays the code.
I want the form to hide the bottom two fields and display one or the other depending on what the nature of the enquiry is. Is there some HTML/ Javascript code that does this and can anyone point me in the right direction.
<script language="Javascript"> <!-- function checkFields(){ var errormsg = ""; if (document.this_form.this_select.value == "") { var errormsg = errormsg + "Please Select an Value.
I am trying to implement a color picker for my users to choose their own custom background colors. I have an ajax color picker that works great but I am having issues passing the picked HEX value to my form. I am also using PHP.
Here is my javascript.
HTML Code: <div id="plugHEX" onmousedown="stop=0; setTimeout('stop=1',100);">FFFFFF</div> This displays the correct value on screen.
However I need to pass that value through a form so that I can update my DB for the user who picked.
My form field should look something like this:
<input type="hidden" name="color" id="plugHEX" value="VALUE FROM PICKER"> I tried putting javascript: getElementbyID(plugHEX); in that spot but it didn't work. Any ideas on how i can grab that value for the hidden field by using HTML, PHP or javascript?
I am making a registration form that users enter information on one page that I want to be able to take the entry information and put it into another page.
I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now.
Originally :
The form is called "form1", and I have selects called "PORTA", "PORTB" ... etc...
I then had javascript that accessed these selects as below, and it worked fine.
ind = document.form1.PORTD.selectedIndex; val = document.form1.PORTD.options[ind].value; dev = document.form1.PORTD.options[ind].text;
My form is now autogenerated, and form data is stored to file, so I now use an associative array for thte form elements (so that I can loop through them easily), The form elements names are now :
McuCfg[PORTA], McuCfg{PORTB} and so on
Now, I modified the javascript so that it now uses the McuCfg[] associative array :
ind = document.form1.McuCfg[PORTD].selectedIndex; val = document.form1.McuCfg[PORTD].options[ind].value; dev = document.form1.McuCfg[PORTD].options[ind].text;
When the script runs, I get the error
"document.form1.McuCfg.PORTD is null or not an object"
I have used the same notation that i know works for the "options" array although that's not an associative array.
Is there some way by which I get to know if the state of my form elements have changed or not ? I mean If I have to save data which has been entered by user in the screen, Is there some way in the JS level that I am able to check (before i pass information to java) if the value of the form element is same or different from the time the page had loaded ?
So ill be able to selelct and save only those elements whose values have been changed