
phpQuestioner
Members-
Posts
1,485 -
Joined
-
Last visited
Never
Everything posted by phpQuestioner
-
Well here is the javascript side of it; you will have to get someone else to help you with the php side, to tired too get into that tonight. I suggest posting a question regarding this type of form processing in the PHP forum on this site. Which Is Located Here: http://www.phpfreaks.com/forums/index.php/board,1.0.html Here's You JavaScript: <script language="javascript"> var i = 0; function addMore() { i=i+1; document.getElementById("fields").innerHTML += "\nItem "+i+": <input type=\"text\" name=\"saleitem"+i+"\"><br><br>" } window.onload = function() { addMore(); } </script> <div id="fields"></div> <br/><br/> <input type="button" value="Add Another Sale Item" onclick="addMore()"> Good Luck
-
when I submit the form it does; don't submit the page back to itself or you will keep getting the confirm prompt. if your going to submit the page back to itself; you need to dynamically change the "occured" variable to "yes" or something else completely. do something like this: <script language="javascript"> var occured="<?php if (isset($_POST['submission'])) { echo "yes"; } else { echo "no"; } ?>"; function ucantgoyet() { if (occured == "no") { confirm("Please Stay!"); document.location = document.URL; } } </script> </head> <body onunload="ucantgoyet()"> <form name="form1" action="somepage.php" method="post"> <input type="submit" name="submission" value="Submit" onclick='occured="yes"; return true'> </form>
-
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
Awesome - I'm glad I got it working for you -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
here is another version; I tricked this one out - pimped my script - lol <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (getEXT == "htm" || getEXT == "html" || getEXT == "php" || getEXT == "pl") // add more file types as needed { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } else { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } } </script> <div id="viewIt"></div> <a href="javascript:void(0)" onclick="getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a> man I must be bored - lol -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
how did it work? -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
alright, try this - I think I just rehashed something I already did; but try it anyway - lol <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (total > "3") { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } else if (getEXT != "htm" || getEXT != "html" || getEXT != "php" || getEXT != "pl") // add more file types as needed { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } else { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } } </script> <div id="viewIt"></div> <a href="javascript:void(0)" onclick="getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a> -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
yeah, I found a bug in the script; I am taking a look at it now. -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
Try this then: <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (total > "3") { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } if (getEXT != "htm") { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } else { document.getElementById('viewIt').innerHTML='index.htm<br><br>'; } } </script> <div id="viewIt"></div> <a href="javascript:getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a> I would like to make this sucker work - lol -
realy a hard question how do i make that in my page
phpQuestioner replied to yanivkalfa's topic in Javascript Help
no problem -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
try this; I thought I would give this one more shot <script language="javascript"> var presently = document.URL; var thisFile = presently.split("/"); var thisExt = presently.split("."); var total = thisFile.length - 1; var totaled = thisExt.length - 1; var getEXT = thisExt[totaled]; function getFileNameAndExt() { if (total > "3") { document.getElementById('viewIt').innerHTML = thisFile[total] + '<br/><br/>'; } else if (getEXT != "htm" || getEXT != "html") // you can keep adding web page extensions as needed { document.getElementById('viewIt').innerHTML='index.htm'; } else { document.getElementById('viewIt').innerHTML='index.htm'; } } </script> <div id="viewIt"></div> <a href="javascript:getFileNameAndExt()">Where Am I At? - Click Here To Find Out</a> -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
Also, after looking at you example; if you are not using htacess file to change your urls into sub-directory urls (so to speak) - then even if you type: "http://www.4tenonline.com/createDatabase/" - you should automatically be redirected to: "http://www.4tenonline.com/createDatabase/index.htm". The only way the url will continuously stay in sub-directory format (without showing the file or extension); is if you have changed your htaccess file or if you are using a script or service to mask the url. -
you still didn't do it like I was telling you to; do it like this: <script language="javascript"> function checkZIP() { var zippy = document.getElementById('zipcode').value.length; if (zippy < "5") { alert("Please Enter A Valid Zip Code"); } else { document.search.submit(); } } </script> <form action="index.php" method="get" name="search" onsubmit="checkZIP(); return false"> <table border="0" cellpadding="3" cellspacing="2"> <tr> <td align="right">Zipcode: <input name="zipcode" id="zipcode" type="text" class="textbox" size="8" maxlength="5"/></td> <td><input type="button" value="Click to Get Gas Prices" onclick="checkZIP();dosearch(this.form)"/></td> </tr> </table> </form>
-
yes; that was the original function that I made.
-
try checking the strings length. you can encode the html characters; if needed.
-
Try setting the min-width for the div or html element that contains that image. I didn't look at the html or css; but I'm sure it is a coding error on there part.
-
try this: <script language="javascript"> var occured="no"; function ucantgoyet() { if (occured == "no") { confirm("Please Stay!"); document.location = document.URL; } } </script> </head> <body onunload="ucantgoyet()"> <form name="form1" action="somepage.php" method="post"> <input type="submit" value="Submit" onclick='occured="yes"; return true'> </form>
-
your not adding the onsubmit() event to the form tag. onsubmit="checkZIP(); return false"
-
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
well I am not going to change my domain forward page for this either - sorry - lol. I am not sure why it's not working; I suggest just keep toying with the script I provided you or look into a server side method of doing this. good luck -
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
yeah, but the else if statement should handle that and I am not quit sure why it is not. do you have a live demo is this; so I can try to replicate this issue? if so, post a link here and let me take a look at it. -
and the code I give you above does just that.
-
do this then: <script language="javascript"> function checkZIP() { var zippy = document.getElementById('zipcode').value.length; if (zippy < "5") { alert("Please Enter A Valid Zip Code"); } else { document.zipform.submit(); } } </script> <form name="zipform" action="gasfinder.php" method="post" onsubmit="checkZIP(); return false"> Zip Code: <input type="text" name="zip" id="zipcode" maxlength="5"> <input type="button" value="Get Gas Now!" onclick="checkZIP()"> </form>
-
How to identify the page type on the current page
phpQuestioner replied to optikalefx's topic in Javascript Help
if you have your htacess file set where it changes your extensions in sub-directory urls; then it's not going to work. example: before htacess change http://www.domain.com/whatever.php after htacess change http://www.domain.com/whatever/ -
realy a hard question how do i make that in my page
phpQuestioner replied to yanivkalfa's topic in Javascript Help
it's called a "lightbox" - google it for tutorials and examples.