Changing the SRC attribute value and removing the ID-less TR element?

in Ideas and script requests
Subscribe to Changing the SRC attribute value and removing the ID-less TR element? 6 posts, 4 voices



johnz User
FirefoxWindows

I need to make these changes, can't figure out how. Here's what I need to do:

Change #1 - SRC attribute value

From:
<script type="text/javascript" src="jschat.aspx" language="JavaScript">
To:
<script type="text/javascript" src="file:///C:/myfiles/jschat.js" language="JavaScript">

Change #2 - STYLE attribute values (Solved)

From:
<div id="idChatUsers" style="overflow: auto; position: relative; height: 225px;" name="idChatUsers">
<div id="idDivRooms" style="overflow: auto; position: relative; height: 75px;" name="idDivRooms">
To:
<div id="idChatUsers" style="overflow: auto; position: relative; height: 97.9%;" name="idChatUsers">
<div id="idDivRooms" style="overflow: auto; position: relative; height: 54px;" name="idDivRooms">
 
smk Scriptwright
FirefoxWindows

ele.style=...
ele.src=...

but i doubt changing the src would make the script reload, you'll need to add another script element and delete the old one

 
johnz User
FirefoxWindows

Thanks for reply smk. I don't know much about coding the js script for deleting an element. Do you mean something like this to delete the element:
script = document.evaluate('//script[@src="jschat.aspx"]',document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null)
for (i = 0; i < script.snapshotLength; i++) {
(foo = script.snapshotItem(i).parentNode.parentNode).parentNode.removeChild(foo)
}
If yes, what's the script for creating an element?
 
teukkam Scriptwright
FirefoxWindows

http://diveintogreasemonkey.org/patterns/insert...

 
johnz User
FirefoxWindows

Thanks for the URL, teukkam, but I can't get the clue. Can you make the script for me?

Anyway, I solved the style changing issue but now the new problem is to make JS script to remove this ID-less TR element:
<tr>
<td class="header"><nobr> Add Room</nobr></td>
<td class="header"></td>
</tr>
Anyone know the solution?
 
JoeSimmons Scriptwright
FirefoxWindows

johnz wrote:
Anyone know the solution?
var elm=document.evaluate("//nobr[contains(.,Add Room')]/../..", document, null, 9, null).singleNodeValue;
elm.parentNode.removeChild(elm);


johnz wrote:
Change #1 - SRC attribute value
var src="file:///C:/myfiles/jschat.js";
var elm=document.evaluate("//script[@src='jschat.aspx']", document, null, 9, null).singleNodeValue;
elm.parentNode.replaceChild((elm.cloneNode(true).src=src), elm);
I don't know if that will work, or even run a js file from your pc (might have to upload a copy online).
Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel