![]() ![]() |
Oct 31 2009, 11:37 AM
Post
#1
|
|
|
Newbie ![]() Group: Members Posts: 12 Joined: 10-October 09 Member No.: 34,409 |
For a sample :
I have my website, which the URL is http://www.mytestsite.com/ < just example not my real Site URL and in The file "index.php", which contain JavaScript command function such as "onHoverTest()" or "clickTest()" the function : onHoverTest() will run its process, when mouse pointer is hover on Web Object (picture, link, etc) and function : clickTest() will run its process, when user click the Web Object (picture, link, etc) So, this is my questions: 1. If some times I want to run one of all functions process at the page start , Without processing condition. - Can I add some command to run script on the address bar after normal URL (Eg. http://www.mytestsite.com/ "add command for runnig script here" ) or anyway? 2. If I want to add some JavaScript command(that have not in the "index.php" file) - can I add it using addressbar after URL (Eg. http://www.mytestsite.com/ "add new JavaCript here") or anyway? Thanks you all for answers If you want more information about my questions Please Reply to ask for it (IMG:style_emoticons/default/smile.gif) PS. I'm not good in using English Language. if I use unproper word, Please forgive me This post has been edited by lovekit: Oct 31 2009, 11:39 AM |
|
|
|
Oct 31 2009, 11:42 AM
Post
#2
|
|
|
Likes gettin' it on! ![]() ![]() ![]() Group: Members Posts: 643 Joined: 24-May 08 From: Rhode Island, USA Member No.: 22,266 Languages: (X)HTML, CSS, Javascript, PHP/MySQL, XML, Java (still gettin a grip on those last couple) |
if you want something to happen when the page loads, there is a function called onLoad, which you can apply to the <body> tag of an HTML document.
|
|
|
|
Oct 31 2009, 06:56 PM
Post
#3
|
|
|
Newbie ![]() Group: Members Posts: 48 Joined: 23-October 09 Member No.: 34,709 |
You can use somthing like this to get values from an url:
CODE <script type=javascript> function GetURLvalues(key) { var regexS = key+"=([^&#]*)"; var results = window.location.match(regexS); if( results == null ) { return ""; } else { return results[1]; } } </script> Lets say that your URL is: www.website.com/index.php?member=Redroest You can call the function like this: GetURLvalues("member"); This will return the value of "member" (in this case Redroest) When this works, you can use this function to activate a java script: CODE <script type=javascript>
if(GetURLvalues("member") == Redroest) { alert("javascript activated with help of the URL that called this page"); } </script> This post has been edited by Redroest: Oct 31 2009, 06:59 PM |
|
|
|
Nov 4 2009, 03:12 PM
Post
#4
|
|
|
Newbie ![]() Group: Members Posts: 12 Joined: 10-October 09 Member No.: 34,409 |
Thanks for answer
but can't Add new acript anyway? I meant without editing html file (in sample is index.php) |
|
|
|
Nov 4 2009, 03:18 PM
Post
#5
|
|
|
Duotone Fox ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 3,585 Joined: 6-November 07 Member No.: 18,212 Languages: (X)HTML, CSS, Javascript, PHP, SQL, XML [DOM]. |
|
|
|
|
Nov 4 2009, 03:34 PM
Post
#6
|
|
|
Devoted Member ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 3,319 Joined: 16-January 08 Member No.: 19,529 |
Without making changes to your document, no. It cannot be done. Your document has to be written so that it is prepared to examine the URI.
|
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 23rd November 2009 - 04:28 AM |