 |
 |
Index ‹ javascript
|
- Previous
- 1
- search engine works fine on internet but not locallyhi
I've found some code on internet for a search engine to search my own
website.
This script works fine on internet, but not on my own computer.
When I typ in a search item, it opens a new browser window containing
the search restults. I click on the search results, and I get
transferred to the appropriate html page. To return to the search
results, I click on the back button of my browser.
And here is where it goes wrong locally. I get a page without any
images and no working links. On internet I get the all images and I can
click on all links.
I have tried changing all the " to ' and all the " to \" but none of it
resolves the problem.
Does anyone see what I don't?
Thanks piet
page="html code .....snip";
function search(frm) {
win = window.open("","","");
win.document.write(page);
txt = frm.srchval.value.split(" ");
fnd = new Array(); total=0;
for (i = 0; i < item.length; i++) {
fnd[i] = 0; order = new Array(0, 4, 2, 3);
for (j = 0; j < order.length; j++)
for (k = 0; k < txt.length; k++)
if (item[i][order[j]].toLowerCase().indexOf(txt[k]) > -1 && txt[k] !=
"") fnd[i] += (j+1);
}
for (i = 0; i < fnd.length; i++) {
n = 0; w = -1;
for (j = 0;j < fnd.length; j++)
if (fnd[j] > n) { n = fnd[j]; w = j; };
if (w > -1) total += show(w, win, n);
fnd[w] = 0;
}
win.document.write('</table> ...snip </BODY> </HTML>');
win.document.close();
}
function show(which,wind,num) {
link = item[which][1] + item[which][0];
line = '<tr><td><a href=\''+link+'\'>'+item[which][2]+'</a>
Score: '+num+'<br>'; line += item[which][4]; //+
"<br>"+link+"</td></tr>"; wind.document.write(line);
return 1;
- 1
- Custom Tags with execCommandDoes anyone know of a way to wrap custom tags around selected text
using execCommand or otherwise?
I am developing a rich text editor for use in a web site and while
there are a few decent ones already floating around I need to
implement a few extra bits of functionality. Specifically tool tips.
Idealy I'd like to wrap custom tags around selected text using
execCommand.
Ie "Selected Text"
becomes:
"<a title='User inputed tooltip'>Selected Text</a>".
Any ideas?
------------------------------------------------------------
Programming is like sex, one mistake and you have to support it for
the rest of your life. (Michael Sinz)
- 4
- JavaScript in .XML file vs .HTML fileI'm trying to understand the difference between using JavaScript in XML and
XHTML. I have a valid XHTML file with a form and some JavaScript. If I save
it as a .html file (this is under Windows), it all works fine, but if I save
it as a .xml file, the script can no longer reference the form.
In the code extract below, when run as xml in Mozilla throws an error on the
line trying to access tf.fname.value saying "tf has no properties". Why is
this?
<script type="text/javascript">
function validate() {
tf = document.taxform;
// Check that required fields are not empty
if (tf.fname.value == "" ||
tf.sname.value == "") {
// do stuff
}
</script>
...
<form
id="taxform"
action="http://teachwww.cogs.susx.ac.uk:8080/egj20/servlet/TaxReturnServlet"
method="post"
onsubmit="return validate()">
<p>
<label for="fname" class="required">First name:</label>
<input id="fname" name="fname" type="text" size="40" maxlength="40" />
</p>
...
</form>
- 5
- Turn CSS listing into JavaScript Array?I have this in a style sheet:
div.track { font-family: Verdana, Arial, Helvetica, sans-serif; }
In a JavaScript function I can pull out Verdana, Arial, Helvetica, sans-serif putting it
into a JavaScript variable fontfamily.
But what I would prefer is an array fontfamily[] where each font-family is an element
of the array.
I tried
var fontfamily = new Array(getComputedStyleForElement(document.getElementById('divTrack'),'fontFamily'));
but no dice. This is a one element Array with
fontfamily[0] = Verdana, Arial, Helvetica, sans-serif
What I was hoping for was:
fontfamily[0] = Verdana
fontfamily[1] = Arial
fontfamily[2] = Helvetica
fontfamily[3] = sans-serif
Any neat ideas how I might do this?
Thanks.
--
George Hester
__________________________________
- 6
- Reading files from a folder?Is there a way in javascript to populate a dropdown formfield with the
contents of a folder? Or, alternatively, to allow folder browsing in
some way instead of expecting the user to type a filename?
--
- 6
- document.write problems...Hi all,
Could someone take a look at
www.worklesshard.com/watermelon/ecard.html and tell me why it works in
Firefox, but not in IE? I've been scratching my head for hours.
Many, many thanks in advance.
Sam
- 8
- Changing Data without Refreshing PageJRS: In article <email***@***.com>, dated Tue, 18
Oct 2005 22:17:47, seen in news:comp.lang.javascript, Evertjan.
<email***@***.com> posted :
>Randy Webb wrote on 19 okt 2005 in comp.lang.javascript:
>> Calling Microsoft "M$" does *not* do anything other than make you look
>> bad.
>
>Why would that be?
>I rather like it,
>so you are not speaking for everybody, Randy.
Using any "false word", such as Micro$oft or Microsloth or Winders,
complicates searching with automated tools. It is childish, being
intended to simulate cleverness.
--
?John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ?
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
The Big-8 newsgroup management is attempting to legitimise its questionable
practices while retaining its elitist hegemony. Read <URL:news:news.groups>.
- 8
- AJAX Mash-up Sites?My research I did a while ago showed there was no possibility to get
web page content from a third-party website with AJAX only, without
using a server side technology. Now I have to re-investigate this case
and look for a workaround, perhaps, to allow client side to get the
content of the external page, living on another server. In case you
are wondering, there is no content stealing: both parties agree to
exchange data.
Please, advise if you know of any examples, links or suggestion as to
how a client can request external page content.
Thanks.
- 8
- newbie helpNom DePlume wrote:
> "Randy Webb" <email***@***.com> wrote in message
> news:email***@***.com...
> : Nom DePlume wrote:
> : > Hi,
> : >
<--snip-->
>
> thanks for your reply. I can see I have a lot to learn. Without getting
> overly complicated, what would be a better way to write this?
>
A better way? Not write it at all. Seriously, put up a link to "How to
bookmark this page" and on the other page, explain how to do it in the
different browsers. It has been discussed here until most people are
tired of discussing it, because there is no reliable way to detect
whether the browser supports the window.external.addFavorite method as
you can't directly test for it.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
- 12
- errors when loading my .js external fileSource code:
Line 11: {
Line 12: oForm.requiredemail.className='backclrPink';
Line 13: alert("The e-mail address you entered is not valid. Please
re-enter your e-mail. The format should be like email***@***.com
(or .net, or .org, etc.)");
Error message:
Compiler Error Message: JS1135: Variable 'alert' has not been
declared
Clicking on Show Detailed Compiler Output:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
\root\6227d372\8fa8293\App_Code.1g3nc3r1.1.js(11,12) : error JS1135:
Variable 'System' has not been declared
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
\root\6227d372\8fa8293\App_Code.1g3nc3r1.1.js(11,12) : error JS1146:
Unknown custom attribute class or constructor
d:\hosting\bro2000az\App_Code\formValid.js(13,3) : error JS1135:
Variable 'alert' has not been declared
d:\hosting\bro2000az\App_Code\formValid.js(85,22) : warning JS1187:
Variable 'tempobj' might not be initialized
d:\hosting\bro2000az\App_Code\formValid.js(86,9) : warning JS1187:
Variable 'tempobj' might not be initialized
d:\hosting\bro2000az\App_Code\formValid.js(2,1) : error JS1234: Only
type and package definitions are allowed inside a library
My request is for someone to help me solve the problem indicated
above.
When I run this using IIS on my computer I do not get this error.
"formValid.js" is where all of the javascript is located. It is
referenced on the .aspx page like this:
<script type="text/javascript" src="..\App_Code\formValid.js"/>
Thank you for any help you offer.
Fred
- 12
- QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()Thanks Lasse for your quick answer...i<ll try your solution and let
you know...yeah you<Re right i tried everything to make my confirm
dialog go away after 1 minute and couldn't. So i'm gonna try you way
and see what happens.
For my 1st question, i do have a logout method, is there any way that
i could use this instead of calling session_end() to force the user to
logout when he exits the application???
Thanks a lot once again....
Lasse Reichstein Nielsen <email***@***.com> wrote in message news:<email***@***.com>...
> email***@***.com (HolaGoogle) writes:
>
> > hi there,
> > i've 2 questions for you guys....
> > 1: is there any way to "force" a session_onend(), session timeout or
> > at least call my logout method when a user leaves the application
> > window without logging out? i.e: using the "X" in the right corner???
>
> No. They might not even be connected to the internet when they close
> the browser.
>
> > 2: I've succesfully been able to ask the user to confirm whether he
> > wants to extend his session before it ends due to inactivity. This
> > works perfectly and my question is: if the user is not there to answer
> > the question is there any way to automaticaly end the session after 1
> > minutes without any answer???
>
> Probably. Don't use a modal confirm dialog, though. You have no way
> of making that go away after one minute. If you use HTML to pose
> the question, you can remove it again, and then do whatever you want.
>
> I.e., something like:
> ---
> /**
> * text : text to display for yes/no answer
> * onYes : optional, function called if yes chosen
> * onNo : optional, function called if no chosen
> * timeout : optional, time in milliseconds before defaulting
> * timeoutDefault: optional, default answer for timeout
> *
> * Don't omit both onYes and onNo.
> */
> function myConfirm(text,onYes,onNo,timeout,timeoutDefault) {
> var div = document.createElement("div");
> div.style.border = "3px grey outset";
> div.style.width="8em";
> div.style.height="6em";
> div.style.background = "grey";
> div.style.position = "absolute"; // or use fixed
> div.style.left = "10em";
> div.style.top = "10em"; // do something to make sure it is visible
> var p = document.createElement("p");
> p.appendChild(document.createTextNode(text));
> div.appendChild(p);
> var div2 = document.createElement("div");
> div2.style.textAlign = "center";
> var butYes = document.createElement("input");
> butYes.style.margin="0px 5px";
> butYes.type="button";
> butYes.value="Yes";
> butYes.onclick= function(){action(true);};
> var butNo = document.createElement("input");
> butNo.style.margin="0px 5px";
> butNo.type="button";
> butNo.value="No";
> butNo.onclick= function(){action(false);};
> div2.appendChild(butYes);
> div2.appendChild(butNo);
> div.appendChild(div2);
> div.style.zIndex = 1;
> document.body.appendChild(div);
> if (timeout) {
> var timer = setTimeout(function(){action(timeoutDefault);},timeout);
> }
> function action(choice) {
> clearTimeout(timer);
> document.body.removeChild(div);
> if (choice) { if (onYes) {onYes();}}
> else { if (onNo) {onNo();} }
> }
> }
> ---
> You can call it as, e.g.,:
> ---
> myConfirm("Are you sure?",
> function(){alert("yes");},function(){alert("no");},
> 5000,true);
> ---
> You should do something more to make sure the dialogue is visible, even
> if the page is scrolled down.
>
> You can save code space by having the confirm HTML already in the page,
> and just changing the actions and text.
>
> /L
- 12
- How to refresh a pop-up?I have a pop-up that I would like to refresh with the original request
that opened it when the user clicks a button. Does anyone know the
function to call?
I tried "self.refresh" and "self.reload", but it give me an error
that object does not support this method.
Can pop-ups be refreshed, or are these only for main windows?
thanks in advance for any help,
Jehan
- 14
- radio buttons and the onChange event handlerHmmm... the onChange handler for radio buttons only seems to work when I
click on the specific radio button. If I cause it to change - become
unchecked - by clciking on another radio button in the group the handler
doesn't get called. Is this the way it's supposed to work?
I want to set optional properties of certain questions depending upon
whether radion button (a) is clicked or not. Is there some other event I
could set the handler for?
Thanks.
- 14
- Focus on IDOK, that's really not a very good subject, but I couldn't think of a
good summary :-)
I have a page that allows people to click on a link for more
information. This link opens an absolutely positioned block that's
positioned based on the width and height of the screen. Here's the
simplified code:
var addposition = -10;
var showLocation = [formatted window code]
if (document.getElementById) {
addposition = addposition + 10;
document.getElementById(showLocation).innerHTML = eventMessage;
document.getElementById(showLocation).style.left = ((screen.width -
300) / 2) + addposition;
document.getElementById(showLocation).style.top = ((screen.height -
286) / 2) + addposition;
}
else {
// other code if document.getElementByID isn't recognized
}
The "addposition" variable forces the blocks to cascade, so if the
visitor clicks on several links then they'll have several "windows"
open, each positioned 10px lower and to the right of the previous one.
Here's the problem. Sometimes the most recently clicked window is
shown on top, and that's great. But sometimes (seemingly at random),
it opens below all of the others, which is incorrect. How can I force
the last one opened to always be on top?
Here's the page:
http://www.gowilkes.com/events/
TIA,
Jason
- 14
- Handing off a file to the browserI'm writing some javascript which uses the XMLHttp object to POST to a
cgi on a server (which I'm also writing). I want it to do something different
depending on what the server replies back:
if the reply contains ERROR, put up an alert dialog box showing the error
otherwise, hand off the downloaded response (which is a file with a
particular mime type) to the browser so it can do its thing (ie, run the
associated helper app).
I can parse for the ERROR and put up the alert, but I'm not sure how to
"hand off" a good response for the browser to handle. Or how to invoke the
browsers mimetype handler once I've received the response. Any ideas?
--
Jonathan Arnold (mailto:email***@***.com)
LinuxBrainDump, Linux HowTo's and Tutorials:
http://www.linuxbrainddump.org
Daemon Dancing in the Dark, an Open OS weblog:
http://freebsd.amazingdev.com/blog/
|
| Author |
Message |
Terry

|
Posted: 2004-1-23 3:04:27 |
Top |
javascript, <!DOCTYPE> & Javacript
Hi,
I am running into this problem with IE 6. The following two pages are
identical except that one has <!DOCTYPE ...> at the beginning of the page
while the other doesn't. The javascript on the page is for a page-by-page
news scroller. IE 6 can only display the one WITHOUT the <!DOCTYPE ...>
http://free.hostdepartment.com/j/javashop/with_doctype.htm
http://free.hostdepartment.com/j/javashop/without_doctype.htm
I know IE6 switches to 2 different modes depending on the <!DOCTYPE ..>
header. But I can't figure out which part in the javascript isn't
compatible with the brower's standard mode.
It will be great if someone can take a look of the code and point out what
is wrong. Thanks in advance!
Terry
|
| |
|
| |
 |
Randy Webb

|
Posted: 2004-1-23 7:15:00 |
Top |
javascript >> <!DOCTYPE> & Javacript
Terry wrote:
> Hi,
>
> I am running into this problem with IE 6. The following two pages are
> identical except that one has <!DOCTYPE ...> at the beginning of the page
> while the other doesn't. The javascript on the page is for a page-by-page
> news scroller. IE 6 can only display the one WITHOUT the <!DOCTYPE ...>
>
> http://free.hostdepartment.com/j/javashop/with_doctype.htm
URL:
http://validator.w3.org/check?uri=http%3A%2F%2Ffree.hostdepartment.com%2Fj%2Fjavashop%2Fwith_doctype.htm
/>
watch for line wrap.
One should attempt to debug X/HTML code before tackling the javascript
code. That may or may not be your problem, but its a start.
--
Randy
Chance Favors The Prepared Mind
|
| |
|
| |
 |
David Dorward

|
Posted: 2004-1-23 7:34:00 |
Top |
javascript >> <!DOCTYPE> & Javacript
Terry wrote:
> http://free.hostdepartment.com/j/javashop/with_doctype.htm
> I know IE6 switches to 2 different modes depending on the <!DOCTYPE ..>
> header. But I can't figure out which part in the javascript isn't
> compatible with the brower's standard mode.
Possibly among other things - but in CSS units are required for non-zero
lengths. width: 34; isn't acceptable (although width: 34em; is). Its also
cursor: pointer, not cursor: hand.
--
David Dorward <http://dorward.me.uk/>
|
| |
|
| |
 |
DU

|
Posted: 2004-1-23 10:43:00 |
Top |
javascript >> <!DOCTYPE> & Javacript
Terry wrote:
> Hi,
>
> I am running into this problem with IE 6. The following two pages are
> identical except that one has <!DOCTYPE ...> at the beginning of the page
> while the other doesn't. The javascript on the page is for a page-by-page
> news scroller. IE 6 can only display the one WITHOUT the <!DOCTYPE ...>
>
> http://free.hostdepartment.com/j/javashop/with_doctype.htm
>
> http://free.hostdepartment.com/j/javashop/without_doctype.htm
>
> I know IE6 switches to 2 different modes depending on the <!DOCTYPE ..>
> header. But I can't figure out which part in the javascript isn't
> compatible with the brower's standard mode.
>
> It will be great if someone can take a look of the code and point out what
> is wrong. Thanks in advance!
>
> Terry
Everything was explained many months ago in this file:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnie60/html/cssenhancements.asp
The W3C CSS1 box model is supported the way it should be when the
document triggers standards compliant rendering mode.
DU
|
| |
|
| |
 |
jonny_xyz_75

|
Posted: 2004-1-23 15:57:00 |
Top |
javascript >> <!DOCTYPE> & Javacript
Terry <email***@***.com> wrote in message news:<email***@***.com>...
> Hi,
>
> I am running into this problem with IE 6. The following two pages are
> identical except that one has <!DOCTYPE ...> at the beginning of the page
> while the other doesn't. The javascript on the page is for a page-by-page
> news scroller. IE 6 can only display the one WITHOUT the <!DOCTYPE ...>
>
> http://free.hostdepartment.com/j/javashop/with_doctype.htm
>
> http://free.hostdepartment.com/j/javashop/without_doctype.htm
>
> I know IE6 switches to 2 different modes depending on the <!DOCTYPE ..>
> header. But I can't figure out which part in the javascript isn't
> compatible with the brower's standard mode.
>
> It will be great if someone can take a look of the code and point out what
> is wrong. Thanks in advance!
>
> Terry
It would appear that XHTML 1.0 transitional is not transitional
enough. I haven't got much time - work in half an hour but enclosing
your script in <!-- //--> and adding \ to your </div>'s = <\/div> got
it working but everything's squashed into top-left corner!
|
| |
|
| |
 |
| |
 |
Index ‹ javascript |
- Next
- 1
- [boolean: IE & Gecko] IE treats false as true? (SOLVED)Martin Honnen wrote:
>
>
> F. Da Costa wrote:
>
>> Following two sniperts of code I'm using and getting very interesting
>> results from.
>>
>> .html
>> <tr id="1" class="segment" open="false">
>
>
> In which HTML version do you find the attribute named open for <tr>
> elements?
> Is the any browser having an object model for <tr> element objects where
> a property named open exists? If so what does the object model tell
> about the type of the property?
>
> What you have done is added your own attribute named open to a HTML <tr>
> element. Whether that attribute is reflected in the DOM as a property
> depends on the browser, IE/Win at least is known to add a property,
> Mozilla is known not to do that. So with IE
> trElement.open
> has a value while with Mozilla
> trElement.open
> is undefined.
This is *exactly* what is happening.
So basically I do not have to supply the attribute in the HTML doc.
If and when required I can add it to the DOM model instead and use it from thereon?
It would explain what is happening to the code.
Never too late to learn.
Thx for the effort and the insight given
> For instance try the following:
>
> <html>
> <head>
> <title>custom attributes and scripting</title>
> <script type="text/javascript">
> function checkAttribute (element, attributeName) {
> if (!element) {
> return;
> }
> else {
> var result = '';
> var attributeValue = element.getAttribute(attributeName);
> result += 'element.getAttribute("' + attributeName + '"): '
> + element.getAttribute(attributeName);
> var propertyType = typeof element[attributeName];
> result += '\n';
> result += 'typeof element["' + attributeName + '"]: ' + (typeof
> element[attributeName]);
> alert(result);
> }
> }
> window.onload = function (evt) {
> if (document.getElementById) {
> checkAttribute(document.getElementById('aP'), 'open');
> }
> };
> </script>
> </head>
> <body>
> <p id="aP" open="false">
> paragraph
> </p>
> </body>
> </html>
>
> With IE6/Win you will see that the property named open is defined but of
> type string so your subject line complaining about booleans simple
> doesn't describe what is happening in the code.
> With Mozilla you will seee that the property named open is undefined so
> all your attempts to access elementVariable.open simply yield undefined
> in Mozilla and again what is happening in code has nothing to do with
> boolean values.
> With Opera 7 you will also find that the property is undefined.
> Thus if you use custom attributes and want to do cross-browser scripting
> then
> element.attributename
> doesn't help, use
> element.getAttribute('attributename')
> instead and be aware that that always returns a string value.
>
>>
>> This is the segment under 'investigation'
>>
>> .js
>> if (segmentRows[i].open || segmentRows[i].open=='true') doWhatever();
>>
>> When running this if statement (made sure that above <tr> is contained
>> in segmentRows[i]) Gecko processes this properly.
>
>
> Ok, with Mozilla the first condition
> segmentRows[i].open
> yields undefined, is converted to a boolean which yields false so the
> second condition
> segmentRows[i].open=='true'
> is evaluated
> 'undefined' == 'true
> is false so the whole condition is false.
>
>> As in it *does not* enter the if.
>> IE 5+ on the other hand alerts (as in debug) me that
>> segmentRows[i].open evaluates to false and subsequently does *not*
>> have any trouble entering the if statement.
>
>
> With IE the first condition
> segmentRows[i].open
> yields 'false', that is converted to a boolean value and any non empty
> string yields the boolean value true so the whole or condition is true.
>
> Not what you want to happen but perfectly correct.
>
> Custom attributes are questionable but if you use them then learn how to
> script them.
- 2
- FAQ Topic - How do I force a reload from the server/prevent caching?-----------------------------------------------------------------------
FAQ Topic - How do I force a reload from the server/prevent caching?
-----------------------------------------------------------------------
To reload a page, use location.reload(). However, this depends
upon the cache headers that your server sends. To change this,
you need to alter the server configuration. A quick fix on the
client is to change the page URI so that it contains a unique
element, such as the current time. For example:
`` location.replace(location.href+'?d='+new Date().valueOf()) ''
If the location.href already contains a Query String, use:
`` location.replace(location.href+'&d='+new Date().valueOf()) ''
http://www.mnot.net/cache_docs/
http://docs.sun.com/source/816-6408-10/date.htm
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://www.jibbering.com/faq/.
The FAQ workers are a group of volunteers.
- 3
- invisible table columnsHi,
I want to do the following. I want to make a table column invisible
to the screen, but I still want to be able to get the innertext that
would have been stored in the cell for certain operations. What would
be the best way to do this.
I currently added an invisible attribute to the column tag. Please
help
- 4
- hlp w/ ajax javascript error (I posted the code this time)So, I'm getting an error on line 27, where I close the first catch
with a curly brace. Here's the code:
[code]
function ShowBlog(page){
document.getElementById('blog').innerHTML = "<p style=\"color:
orange; font-weight: bold;\"><i>Loading, I appreciate your
patience . . .</i></p>";
var xmlHttp;
// Creating the xmlHttp var depending on the browser
try{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser does not support AJAX!");
return false;
}
}
}
var url = "../php/blog-ReturnStr.php";
var params = "page=" + page + "accesslvl=" + <?php if
(isset($_SESSION['_ACCESSLVL'])){ echo $_SESSION['_ACCESSLVL']; } else
echo "1"; ?>;
xmlHttp.open("GET", url+"?"+params, true);
xmlHttp.onreadystatechange=function(){
if(xmlHttp.readyState==4){
document.getElementById('blog').innerHTML = xmlHttp.responseText;
}
else if (xmlHttp.readyState == 2 | 3){
document.getElementById('blog').innerHTML = "<p style=\"color:
orange; font-weight: bold;\"><i>Loading, I appreciate your
patience . . .</i></p>";
}
}
xmlHttp.send(null);
}
[/code]
Can anyone tell me why it would be giving me the error msg there? I'm
not getting the same error in Mozilla, and I've searched around and
haven't been able to find any info on issues with cross browser
support for try & catch.
- 5
- Cross browser DHTML, ala quirksmodeHey all:
I'm stuck. I'm using the code from www.quirksmode.org for cross
browser access to HTML elements, but I'm getting a javascript error.
The relevant code:
function getObj(name)
{
if (document.getElementById)
{
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all)
{
this.obj = document.all[name];
this.style = document.all[name].style;
}
else if (document.layers)
{
this.obj = document.layers[name];
this.style = document.layers[name];
}
}
OK -- this is straight from quirksmode, and I have seen the same or
similar code in just about every javascript library. I have the
following HTML:
<img id="right_image" src="data/1.gif" alt="right image" />
And the following css:
#right_image
{
position: absolute;
}
So, when I call:
var rightImage = new getObj('right_image');
I get an error:
"Error: document.getElementById(name) has no properties"
However, if I comment out "this.style =
document.getElementById(name).style;" from the getObj function, the
error goes away.
So, what am I doing wrong?
-CJL
- 6
- Bi-directional Dependent Dynamic List MenuI'm looking to modify the javascript behavior on
http://research.yale.edu/%7Ekamusi/exercises/learners/index.php to do
two things:
Initial State: Both menus are populated with all their entries (as is
the case currently).
1. On selecting a topic, the Skills menu will only show those Topics
with dependencies (which will be provided) and vice versa.
2. On clicking the "Go" button, whichever combination (or just a Topic
or Skill) is selected and passed to the URL field.
Ordinarily, I'm a PHP dude and sweated enough to get the current
javascript working (javascript too finicky:(). On doing some research
(ie googling:) ), I have come across only uni-directional dependencies
(ie, "Skills" is dependent on "Topics", not vice versa). Anyone has any
idea of how to get this bidirectional dependency without creating some
sort of looping behavior(how I see it if I were just to tweak the
uni-directional code that DreamWeaver for example generates)?
Thanks,
paa.kwesi
- 7
- 8
- Capture window in *standalone* javascriptHi!
I am a javascript newbie. I want to make a capture window in
*standalone* (in a *.js file) javascript, much in the same way as the
VBscript inputbox() function. I can make it inside a *.html file with
the prompt() function.
Or, is there a way to make a window and then work with this window?
Thanks in advance.
Regards
Marco
-------------------
Freedom is not a permission for chaos.
- 9
- event.keyCode, where can I get a map for these?I would like to know what keycode # pertains to what keycode . . .
This code allows a user to limit the entries in a form to only those
keycodes they would like, #s only for US zip codes, for example. What I
would like to know is what keycode #s pertain to what keycode. There should
be a list out there somewhere, no?
http://javascript.internet.com/forms/block-press-script.html
--
Please contact me if you have any questions,
Patrick Gibbons
email***@***.com
- 10
- javascript accessing i.e "data[3]" in a formHi
I am working on a PHP-script and need javascript to set the value of a
hidden field in a form. This field happens to be an entry in an array
data[3] according to my example. How can I do this?
Below is listet two PHP-pages: one that doesn't work (to my dismay), and
another that does work, but do not use an array entry in the hidden field.
Thanks
Esben
---------- Doesn't work as planned -----------------
<? print "data[3]=".$data[3]."\n";?>
<form action='<?$PHP_SELF?>' name='edit_form' method=post
enctype='multipart/form-data'>
<input type=hidden name='data[3]' value='default :-('>
<script language='javascript'>
document.edit_form.data[3].value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
----------Doesn't use arrays----------------------------
<? print "data3=".$data3."\n";?>
<form action='<?$PHP_SELF?>' name='edit_form' method=post
enctype='multipart/form-data'>
<input type=hidden name='data3' value='default :-('>
<script language='javascript'>
document.edit_form.data3.value = 'not default :-)';
</script>
<input type='submit'></form>
----------------------------------------------------------
- 11
- Detecting line wrap and adding "..." to overflowed wordsI have a div box with a border, and some padding left and right. It has
some text with different font sizes, and a few icons. I want to cut off
any overflow at the end of the line with "...", instead of the text
wrapping. What is the best way I can detect whether the line wrapped,
and how many characters to cut off at the end?
- Jason
- 12
- Help Please with Button Actions - JavaScriptCan any one please help me...I am new to JavaScript and I have been
struggling with this code for days now and can't figure it out.
I would like to get the Buttons to correspond with the action to
either a) generate numbers b) Prompts a user to locate a web page c)
go to previous page in history list d) Loads next page in history list
e) Promps the user for a URL and loads the web page in a new window f)
and Re-Sizes the window.
Please view my coding below, the only button that seems to work is
'Print'.
What am I doing incorrectly here? Can anyone tell me please or help me
solve this problem?
Thanks so much....
<HTML>
<HEAD>
<TITLE>Numbers per Loto Winners - JavaScript Button Action</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
function DrawNumbers( )
{
for (var x=1; x<7;x++)
{
var num = Math.round(math.random( )*100;
switch (x)
{
case 1:
document.frmNumbers.txtnum1.value = num;
break
case 2:
document.frmNumbers.txtnum2.value = num;
break
case 3:
document.frmNumbers.txtnum3.value = num;
break
case 4:
document.frmNumbers.txtnum4.value = num;
break
case 5:
document.frmNumbers.txtnum5.value = num;
break
case 6:
document.frmNumbers.txtnum6.value = num;
break
default: alert("x doesn't match")
}
}
}
function prompt( )
{
var strFind
strFind=prompt("Weekly Employees")
window.find(strFind)
}
function back( )
{ var back
back=Go back
window.back( )
}
function forward( )
{
window.forward( )
}
function home( )
{
window.home( )
}
function openwindow( )
{
window.open("http://www.cdicollge.com")
}
function response( )
{
var response
response = confirm("Do you wish to print this page?")
if (response = true)
window.print( )
else
alert("Printing has been rejected")
}
function ResizeBy( )
{
var Width = window.outerWidth / 2
var Height = window.outerHeight / 2
window.resizeBy(Width,Height)
}
function ResizeTo ( )
{
window.resizeTo(300,300)
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<H1 Align=center> <Font Face=Arial Color=Red> Weekly Employee Lottery
Draw </Font></H1>
<Center>
<Font Face=Arial Size=3 Color=Blue>
<FORM NAME="FrmNumbers">
Number 1<INPUT TYPE="text" NAME="txtnum1" VALUE="0" SIZE="10"><BR>
Number 2<INPUT TYPE="text" NAME="txtnum2" VALUE="0" SIZE="10"><BR>
Number 3<INPUT TYPE="text" NAME="txtnum3" VALUE="0" SIZE="10"><BR>
Number 4<INPUT TYPE="text" NAME="txtnum4" VALUE="0" SIZE="10"><BR>
Number 5<INPUT TYPE="text" NAME="txtnum5" VALUE="0" SIZE="10"><BR>
Number 6<INPUT TYPE="text" NAME="txtnum6" VALUE="0"
SIZE="10"><BR><BR><HR><HR>
<INPUT TYPE="button" NAME="cmdDraw" VALUE="Generate Numbers"
onClick="DrawNumbers ( )">
</FORM>
<FORM NAME="buttonAction">
<INPUT TYPE="button" NAME="buttonPrompt" VALUE="Find"
onClick="window.prompt( )">
<INPUT TYPE="button" NAME="buttonBack" VALUE="Go Back"
onClick="window.back( )">
<INPUT TYPE="button" NAME="buttonForward" VALUE="Go Forward"
onClick="window.forward( )">
<INPUT TYPE="button" NAME="buttonHome" VALUE="Home"
onClick="window.home( )">
<INPUT TYPE="button" NAME="buttonWindow" VALUE="Open Window"
onclick="openwindow()">
<INPUT TYPE="button" NAME="buttonPrint" VALUE="Print"
onClick="window.print()">
<INPUT TYPE="button" NAME="buttonResizeBy"VALUE="Resize"
onClick="ResizeBy(-50,-50)">
<INPUT TYPE="button" NAME="buttonResizeTo"VALUE="Resize"
onClick="ResizeTo(300,300)">
</FORM>
</FONT>
</CENTER>
</BODY>
</HTML>
- 13
- How to concatenate multiple web pages into one and show ONLY this ONE in browser ??Wladimir Borsov said:
>I could imagine to use a proxy which collects at first all the 10 web pages.
>But how do I concatenate them with a minimum of effort?
First you get the permission of the owners of the 10 sites,
then you write code on the server, using PHP or ASP or CGI,
etc, to combine them into one page. You'll have to decide
what to do if two or more have scripts or CSS specifications
that conflict or if one has invalid markup that makes the
following pages unreadable, etc.
- 14
- fso question.a simple question.
how can i get the path of the html that on browser now?
i think default fso path is "c:\document~~\usrname\background".
i noticed relative path "." means there always. doesn't care what html
file i see which is
in another path like "c:\test".
i want to get the path the current html is in.
- 15
- naming a created elementhi all!
when u create an element, how can u then give it a name so that if fo
example it is a form element it gets posted on submit. Also is it
possible to assgn an id too.
kind regards
marc
|
|
|