473,408 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Problem setting string in array (IE)

3
Hello,

I'm trying to assign strings to array elements in javascript. It works in Firefox but in IE it throws "Unknown runtime error".

Expand|Select|Wrap|Line Numbers
  1. sContent = '<p>this is a features test post.</p><p><a title="test" href="http://url.com">link</a></p>';
  2.  
  3. g_ImageTable[g_imax++] = new Array ('<?php echo $sFeatureImgUrl; ?>', '<?php echo $iId; ?>', '<?php echo $sPermalink; ?>', '<?php echo $sTitle; ?>', sContent, '<?php echo $sCategory; ?>', '<?php echo $sTime; ?>', '<?php echo $sAuthor; ?>');
Then it breaks when I try to use that array entry -

Expand|Select|Wrap|Line Numbers
  1. getobject("Ath_PostContent").innerHTML = g_ImageTable[g_iimg][4];
sContent is offset 4 and in debugging, that's where it dies.

The contents of sContent at that time are

[HTML]"<p>another feature post. another feature post. another feature post. another feature post. another feature post. another feature post. another feature post. another feature post. another feature post. another feature post. another feature post. another feature post.</p>"[/HTML]
I'm not quite sure what else to try.

Any ideas?
Sep 11 '06 #1
3 1867
Banfa
9,065 Expert Mod 8TB
It would be helpful to see the actual source code that the browser is seeing rather than the code before it has been run through the PHP.
Sep 11 '06 #2
herrin
3
It would be helpful to see the actual source code that the browser is seeing rather than the code before it has been run through the PHP.
Sure thing - sorry

Expand|Select|Wrap|Line Numbers
  1. sContent = '<p>this is a features test post.</p><p><a title="test" href="http://url.com">link</a></p>';
  2. g_ImageTable[g_imax++] = new Array ('http://www.url.com/2.jpg', '4', 'http://url.com/features/this-is-a-feature-test/', 'this is a feature test', sContent, '<a href=\"http://url.com/category/features/\" title=\"View all posts in features\" rel=\"category tag\">features</a>', 'September 10th, 2006 at 8:09pm', 'optimus');
Sep 11 '06 #3
herrin
3
Geez, it so happens that my .innerHTML was pointing at a span. When I changed it to a div it worked fine.

Expand|Select|Wrap|Line Numbers
  1. getobject("Ath_PostContent").innerHTML = g_ImageTable[g_iimg][4];
before:
Expand|Select|Wrap|Line Numbers
  1. <p align="center"><b>Ath_PostContent:</b> <span id="Ath_PostContent"> </span> </p>
after:
Expand|Select|Wrap|Line Numbers
  1. <p align="center"><b>Ath_PostContent:</b> <div id="Ath_PostContent"> </div> </p>
Sorry to waste anyones time.
Sep 11 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Christopher Benson-Manica | last post by:
Why would this code... Date.prototype.addDays=function( days ) { this.setDate( this.getDate()+days ); } ....break the Date constructor? If I don't include it, everything is fine. If I do,...
4
by: thomastk | last post by:
Hi, In the following script, I am trying to set selection to a select option element, that is newly created within the script. It works fine on IE installations on Windows 2000 and some XP...
15
by: Ron L | last post by:
We are working on a distributed VB.Net application which will access a SQL database located on a known server. Each client will run on the user's local machine. To implement this, we are trying...
0
by: PD | last post by:
I am trying to stream out a PDF file via the response object and when I execute the code it always brings up the first document that I pulled up.Even when I step through the code, I can see the new...
2
by: ajikoe | last post by:
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg. /* File : example.c...
1
by: rory | last post by:
Have the following setting in my app.config: <setting name="Scenes" serializeAs="Xml"> <value> <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
11
by: jesdynf | last post by:
I'm having trouble applying a stylesheet to content I'm generating after the fact. Here's the sample code: <html> <head> <title>CSS/DOM Problem Example</title> <style type="text/css">...
0
by: Filemaxor | last post by:
I have gotten my code to be able to allow people to add new text to a .txt document and able to call up files so the user can see whats in it. The problem i'm having is getting the for loop to work...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.