hacknsack
-
Posts
183 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by hacknsack
-
-
The onclick in the post refers to whatever element you want to control the radio input.So it could be an image, span, div etc.This example uses an image:
<html> <head> <title></title> <script type="text/javascript"> function pickRad(field, i){ var radioGroup = document.forms[0].elements[field]; radioGroup[i].checked = true; } </script> </head> <body> <form> <input type="radio" name="folders" value="1"> <img src="http://w3schools.invisionzone.com/style_images/1/f_norm.gif" onclick="pickRad('folders', 0)" alt="New Posts" border="0"> <br> <input type="radio" name="folders" value="2"> <img src="http://w3schools.invisionzone.com/style_images/1/f_norm_no.gif" onclick="pickRad('folders', 1)" alt="No New Posts" border="0"> <br> <input type="radio" name="folders" value="3"> <img src="http://w3schools.invisionzone.com/style_images/1/f_hot.gif" onclick="pickRad('folders', 2)" alt="Hot Topics" border="0"> </form> </body></html>
The radio buttons are indexed as a group( like an array ) so the first's index is 0.Let us know if you have questions.
-
Contact Form
in PHP
I would start by repairing this line:
$val = preg_replace( "/\\\(?!&#|?#)/", "\", $val );
In that line you have unintentionally "escaped" a quotation mark. Try it like:
$val = preg_replace( "/\\\(?!&#|?#)/", "\\", $val );
Let us know if you need more help with it.
-
You are very welcome, :)Glad to hear you worked it out.
-
You will find some good info here:Form ValidationLet us know if you have questions.
-
You're welcome.Glad you got it working,
-
Maybe something about your test of values.You could throw in some 'echo' statements for debuggin'.
<?phpif(isset($_POST['pw'])) { $user = 'gsmith'; $topsecret = "wwwdot"; if($_POST['user'] == $user && sha1($_POST['pw']) == sha1($topsecret)) echo "passed"; else echo "failed";}?><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> User: <input type="text" name="user" value="gsmith"><br> Password: <input type="text" name="pw" value="wwwdot"><br> <input type="submit"></form>
-
Strange line to put in the documentation for hash(),
?might? At least your options have better version info:sha1(), md5()What I can tell you is that I'm using 4.3.7 on XP and md5() and sha1() both work.The hash() does not.You'll want to remove the single quotes : $pssword = sha1('$_POST["password"]');Good Luck,(no version information, might be only in CVS) -
You have to declare php variables with the '$'.Check this tutorial page,PHP SyntaxThis is an example of how your code should look:
<?php$BMcp0 = 'http://www.google.com';$TEXTCP = 'Search';$cplink = "| <a href=\"".$BMcp0."\"><span class=\"navtd\">".$TEXTCP."</span></a>";echo $cplink; ?>
Let us know if you need more help.
-
Anytime,
-
You have a couple of things wrong here.1) XML, XSLT is case sensitive.2) You've extended your paths.3) You'll need to remove the dashes in your XML file.
<xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><html><body><h2>My CD Collection</h2><table><tr><th>first header</th><th>second header</th></tr><xsl:for-each select="catalog/cd"><tr><td><xsl:value-of select="title"/></td><td><xsl:value-of select="artist"/></td></tr></xsl:for-each></table></body></html></xsl:template></xsl:stylesheet>
And you'll want to remove the dashes from your xml file.Let us know if you have more questions.
-
You are welcome for the help, and yes that is what it does.
-
The following pattern will test for any "non-word" character or underscore in the string.
$pattern= "/[\W_]/";
Let us know if it needs tweaking.Thanks,
-
While I tested the original code in IE, FF and Opera, I agree with Jonas that it will be a better model if we adjust our tests.
<html> <head> <title></title> </head> <body> <script type="text/javascript"> function mkRandom(){ var r = Math.random(); switch (true){ case(r <= .33): document.write('One'); break; case(r > .33 && r <= .66): document.write('Two'); break; default: document.write('Three'); break; } } mkRandom(); </script> </body></html>
Thanks,
-
Tura,I'm not sure exactly how you want the outcome calculated.This example breaks the random number down to "thirds"( .33 )
function mkRandom(){ var r = Math.random(); switch (true){ case(r < .33): alert('First'); break; case(r < .66): alert('Middle'); break; default: alert('Last'); break; } }
Let us know if you have any questions,
-
The problem is security, crossing domains is not allowed( depending on the browser ).@boen_robot, your code works good in IE even across the domains.When used in FF it gives the error "uncaught exception: Permission denied".See "Security Issues" in this article:xmlhttpreq.html@davon, Are you using something server side that can retreive and store the xml file.
-
Weird Problem
in PHP
This will test if the id is set in the URL, if it is not it's default value will be 0.
<?php$id = 0;if(isset($_GET['id']))$id = intval($_GET['id']); switch($id) { case 1: include('cutenews/show_news.php'); break; case 2: include('dls.htm'); break; case 3: include('sotwnews/show_news.php'); break; case 4: include('affs.htm'); break; default: include('cutenews/show_news.php'); break; }?>
Post back if you have any questions.
-
Well Done.
-
Here's a reference that you may find helpful, some of the reading I've already done indicates that you can have multiple "includes":Chapter 17 of the XML Bible
Apologies if this is no help, but looks like you are venturing into new territory.As I complete the tutorials here at W3, maybe I'll be a little more helpful.Good Luck,The xsl:import and xsl:include elements enable you to merge multiple style sheets so that you can organize and reuse style sheets for different vocabularies and purposes. -
You're welcome, .Thanks for posting the improved code.
-
Since you are working with field names that are dynamic how about assigning a class.You can cycle through the fields and check values accordingly, like:
<html><head> <script type="text/javascript"> function ckFields(form){ for(var j = 0; j < form.elements.length; j++){ var field = form.elements[j]; if(field.type == 'text' && field.className == 'textStr' && !ckStr(field)){ return false; } if(field.type == 'text' && field.className == 'textNum' && !ckNum(field)){ return false; } } return true; } function ckStr(field){ // whatever test you need here if(field.value.length == 0){ alert("You forgot something..\n" + field.name.replace(/_/, ' ') + " needs a value"); return false; } return true; } function ckNum(field){ // whatever test you need here // the next line tests to see if the value is an Integer if(!/^\d+$/.test(field.value)){ alert("You forgot something..\n" + field.name.replace(/_/, ' ') + " needs a value"); return false; } return true; } </script></head><body> <form name="formA" onsubmit="return ckFields(this)"> Not Required: <input type="text" name="notRequired"><br> Input 1 (Required String): <input type="text" name="Input_1" class="textStr"><br> Input 2 (Required Number): <input type="text" name="Input_2" class="textNum"><br> <input type="submit" value="Submit"> </form></body></html>
Thanks,
-
Since you are using asp which can read the database why would you require a static xml file?Even though a link calls an "asp" script it's output can be xml?Notice that when you call this link:guestbook.aspIt's output is xml, this is controlled by the "mime" type returned by the server.
response.ContentType = "text/xml"
In case you still need to write the xml file here's a referecne to the OpenTextFile method:OpenTextFileLet us know if you need more..
-
I think what Apollyein is after is a way to convert the new lines in the textarea to a "html" line break.We can use a regular expression and check for new lines and convert that to "<br>".
<html><head><style type="text/css">span{float:left;width:0.7em;font-size:400%;font-family:algerian,courier;line-height:80%;}</style><script LANGUAGE="JavaScript"><!-- Beginning of JavaScript -function MyWindow(message) {//Define regular expression for line breakre = /(\r\n)|(\n)/g//Define contents of pagefirst= '<span>' + message.substring(0,1) + '</span>'message = message.substring(1)contents='<html>'+'<head>'+'<style type="text/css">'+'span'+'{'+'float:left;'+'padding-right: 12px;'+'font-size:200%;'+'font-family:Celticmd,algerian,courier;'+'line-height:80%;'+'}'+'</style>'+'<body bgcolor="white"><br><br><br><br>'+'<p><span>'+first+'</span> '+message'</p>'+'</body>'+'</HTML>'//Create new Windowoptions = "toolbar=1,status=1,menubar=1,scrollbars=1," +"resizable=1,width=900,height=600";newwindow=window.open("","FormattedStory", options);newwindow.document.write(contents.replace(re, "<br>\n"));newwindow.document.close();}// - End of JavaScript - --></SCRIPT></head><body><center><form><textarea rows="30" cols="80" id="inputstory">Copy and Paste Your Story Into This Box.</textarea><br><INPUT NAME="submit" TYPE=Button VALUE="Format" onClick="MyWindow(this.form.elements['inputstory'].value)"></form></center></body></html>
Thanks,
-
@bc,You may find what you're after here:XML on the Server-Getting XML from a DatabaseLet us know if you have questions,
-
muybn,What is your target(Browser)? IE only?Did you include both source definitions(xml(src) and (table)datasrc)?
<xml id="cdcat" src="cd_catalog.xml"></xml><table border="1" datasrc="#cdcat">
If you are after a broader audience you might check out the DOM method.Cross Browser DOMThanks,
Contact Form
in PHP
Posted
The line is in your clean_value() function.