[PHP] php - jscript - onclick event..
hi.. a somewhat php/jscript question... i have the following onclick that works... - div id=cms-edit-buttona href=# onclick=cms_focus ('cms-edit', 1); cms_focus ('cms-properties', 1); cms_focus ('cms-state', 99); this.blur (); return falseAccount/a/div i'd like to be able to have the jscript run if i have a query var foo. basically, i'd like a way of running the same jscript that gets run during the onClick, when i select a php function... ie, if i finish a pprocess, i'd like to set the appropriate page to display. i thought i could do something like the following: ? if ($_GET['tmp']) { echo script language=\javascript\ alert(''); cms_focus ('cms-edit', 1); /script ; echo script language=\javascript\ cms_focus ('cms-properties', 1); /script ; echo script language=\javascript\ cms_focus ('cms-state', 99); /script ; echo script language=\javascript\ return false; /script ; } ? my hope was that this would effectively simulate the running of the jscript.. but it didn't seem to work. the tabs/screens don't change, which indicates that the jscript is not running as i thought it would the above php/jscript is being called after the jscript cms_focus routine has been created. in the above sample, i discovered that if i placed all 3 cms_focus calls in the same script/script block, only the 1st one seemed to run... however, even with this, while it appears that each cms_focus call is being made, there's still not apparent change in the display. the actual cms_focus routine is listed below. all it really does is to set the focus of the given div/id the given section/id of 99 is set to be a block display, with the rest set to be unseen. any ideas/help would be useful.. i'm pretty sure i'm running into a simple problem.. this should be doable. if you need me to, i can supply the entire test php page, as it's not too long. also, if you need additional clarification, let me know.. this might be somewhat jumbled. thanks -bruce [EMAIL PROTECTED] test cms_focus function script language=javascript type=text/javascript !-- function cms_focus (element, index) { e = document.getElementById (element); p = document.getElementById ('cms-panels'); alert(element+ +index); if (element == 'cms-edit') { if (index == 1) { document.getElementById('role').style.display = 'none'; document.getElementById('team').style.display = 'none'; document.getElementById('disabled').style.display = 'none'; document.getElementById('public').style.display = 'none'; } else { document.getElementById('role').style.display = 'inline'; document.getElementById('team').style.display = 'inline'; document.getElementById('disabled').style.display = 'inline'; document.getElementById('public').style.display = 'inline'; //e = document.getElementById (element); p = document.getElementById ('cms-panels'); f = document.getElementById ('subbtn'); //e.style.left = p.offsetLeft; //e.style.top = p.offsetTop - 100; f.style.top = p.offsetTop - 40; document.getElementById('subbtn').style.display = 'block'; } } if (element == 'cms-properties') { if (index == 1) { document.getElementById('cms-properties').style.display = 'none'; } else { e = document.getElementById ('cms-properties'); f = document.getElementById ('subbtn'); p = document.getElementById ('cms-panels'); e.style.left = p.offsetLeft; e.style.top = p.offsetTop - 690; f.style.top = p.offsetTop - 650; document.getElementById('cms-properties').style.display = 'block'; document.getElementById('subbtn').style.display = 'block'; } } if (element == 'cms-state') { if (index == 1) { document.getElementById('cms-state').style.display = 'none'; } else { e = document.getElementById ('cms-state'); f = document.getElementById ('subbtn'); p = document.getElementById ('cms-panels'); e.style.left = p.offsetLeft; e.style.top = p.offsetTop - 690; f.style.top = p.offsetTop - 650; document.getElementById('cms-state').style.display
Re: [PHP] php - jscript - onclick event..
First of all, I _think_ this is more of a javascript/jscript question than a php one. Are you just trying to make a javascript call from php onload? If so, i'm pretty sure you can use window.onLoad in a script block in the head. Also, be sure to set your scripting type in the onclick. i.e. onclick=javascript:cms_focus(foo); also, not quite seeing the point in the return false in the head here: script language=\javascript\ return false; /script I'm prolly not seeing what you are trying to do, try to break it down a bit more. One at a time. C On 6/22/05, bruce [EMAIL PROTECTED] wrote: hi.. a somewhat php/jscript question... i have the following onclick that works... - div id=cms-edit-buttona href=# onclick=cms_focus ('cms-edit', 1); cms_focus ('cms-properties', 1); cms_focus ('cms-state', 99); this.blur(); return falseAccount/a/div i'd like to be able to have the jscript run if i have a query var foo. basically, i'd like a way of running the same jscript that gets run during the onClick, when i select a php function... ie, if i finish a pprocess, i'd like to set the appropriate page to display. i thought i could do something like the following: ? if ($_GET['tmp']) { echo script language=\javascript\ alert(''); cms_focus ('cms-edit', 1); /script ; echo script language=\javascript\ cms_focus ('cms-properties', 1); /script ; echo script language=\javascript\ cms_focus ('cms-state', 99); /script ; echo script language=\javascript\ return false; /script ; } ? my hope was that this would effectively simulate the running of the jscript.. but it didn't seem to work. the tabs/screens don't change, which indicates that the jscript is not running as i thought it would the above php/jscript is being called after the jscript cms_focus routine has been created. in the above sample, i discovered that if i placed all 3 cms_focus calls in the same script/script block, only the 1st one seemed to run... however, even with this, while it appears that each cms_focus call is being made, there's still not apparent change in the display. the actual cms_focus routine is listed below. all it really does is to set the focus of the given div/id the given section/id of 99 is set to be a block display, with the rest set to be unseen. any ideas/help would be useful.. i'm pretty sure i'm running into a simple problem.. this should be doable. if you need me to, i can supply the entire test php page, as it's not too long. also, if you need additional clarification, let me know.. this might be somewhat jumbled. thanks -bruce [EMAIL PROTECTED] test cms_focus function script language=javascript type=text/javascript !-- function cms_focus (element, index) { e = document.getElementById (element); p = document.getElementById ('cms-panels'); alert(element+ +index); if (element == 'cms-edit') { if (index == 1) { document.getElementById('role').style.display = 'none'; document.getElementById('team').style.display = 'none'; document.getElementById('disabled').style.display = 'none'; document.getElementById('public').style.display = 'none'; } else { document.getElementById('role').style.display = 'inline'; document.getElementById('team').style.display = 'inline'; document.getElementById('disabled').style.display = 'inline'; document.getElementById('public').style.display = 'inline'; //e = document.getElementById (element); p = document.getElementById ('cms-panels'); f = document.getElementById ('subbtn'); //e.style.left = p.offsetLeft; //e.style.top = p.offsetTop - 100; f.style.top = p.offsetTop - 40; document.getElementById('subbtn').style.display = 'block'; } } if (element == 'cms-properties') { if (index == 1) { document.getElementById('cms-properties').style.display = 'none'; } else { e = document.getElementById ('cms-properties'); f = document.getElementById ('subbtn'); p = document.getElementById ('cms-panels'); e.style.left = p.offsetLeft; e.style.top = p.offsetTop - 690; f.style.top = p.offsetTop - 650; document.getElementById('cms-properties').style.display = 'block'; document.getElementById('subbtn').style.display = 'block'; } } if (element == 'cms-state') { if (index == 1) { document.getElementById('cms-state').style.display = 'none'; } else { e = document.getElementById ('cms-state'); f = document.getElementById ('subbtn'); p = document.getElementById ('cms-panels'); e.style.left = p.offsetLeft; e.style.top = p.offsetTop - 690; f.style.top = p.offsetTop - 650; document.getElementById('cms-state').style.display = 'block'; document.getElementById('subbtn').style.display = 'block'; } } e.style.zIndex = index; if (index == 99) { b = document.getElementById (element + '-button'); b.style.fontWeight = 'bold'; b.style.backgroundColor = 'eee'; b.childNodes[0].style.color = 'd60'; } else
[PHP] Re: php - jscript - onclick event..
This doesn't answer your question whatsoever (sorry), but is meant merely as a friendly recommendation: DON'T use JScript !! JScript only works with Internet Explorer 4-6 (as far as I've been able to tell, it doesn't even work with IE 7 in Longhorn), just like the original JavaScript only works in the old Netscape 4.x browsers. Instead use proper JavaScript 1.0 - 1.2, and you'll have code that works in nearly all current browsers. I don't know if you actually MEAN JScript, or meant to say JavaScript, but it's two different languages, however closely related. I didn't check your code to see if it's JScript or JavaScript, but when you know PHP and Java, JScript is a beast to work with, because it has so little in common with Java and JavaScript that it's no wonder MS lost the lawsuit. I do have the documentation for JScript, but it's 6000 km away, so I can't really reach it atm ... FWIW Rene Documented research indicate that on Wed, 22 Jun 2005 10:15:53 -0700, bruce wrote: hi.. a somewhat php/jscript question... -- Rene Brehmer aka Metalbunny We have nothing to fear from free speech and free information on the Internet, but pop-up advertising! http://metalbunny.net/ My little mess of things... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] JScript
Hi I know this is not a javascript mailing list and I do apologies. Does anyone know how display a javascript window, WITHOUT having to reload or refresh a page on which the link was clicked Below is a copied and pasted section of my code Please keep in mind that I am new to javascript Kind Regards Brent Clark echotdstronga href=\scanbatch.php?display=1\ onclick=\window.open('displaybcode.php?file=$var','Test','height=300,width= 300,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes');\$va r/a/strong/font/td; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] JScript
Hi sorry I figured it out here is my example Kind Regards Brent Clark echotdstronga href=\\ onclick=\window.open('displaybcode.php?file=$var','Test','height=300,width= 300,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes');opener =self;return false;\$var/a/strong/font/td; I add this part after the jscripts ) opener=self;return false; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php