webForumDet fria alternativet

IFRAME >> Scrollbar?

9 svar · 435 visningar · startad av Jesper T

Jesper TMedlem sedan nov. 20017 144 inlägg
#1

Hej!

Går det att ändra(scrolla) "storlek" på denna iframe med en scrollbar? Och i sådana fall; Hur?

 
<iframe id=myEditor src="edit.htm" onFocus="initToolBar(this)" width=99% height=100%></iframe>

MVH Jesper T

frankofMedlem sedan jan. 20016 874 inlägg
#2

det bestämmer du i "edit.htm"
Fast jag är inte säker på att jag fattade frågan rätt ;)

Jesper TMedlem sedan nov. 20017 144 inlägg
#3

Jo, det är nog så det, men jag har ändrat "scroll" till Scrolling och till yes osv. men inget händer detta är edit.htm:

<html>
<head>
<title>pipeline.nu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<STYLE>
  BODY {margin: 0pt; padding: 0pt; border: none}
  IFRAME {width: 100%; height: 100%; border: none}
</STYLE>
<SCRIPT>
// Default format is WYSIWYG HTML
var format="HTML"

// Set the focus to the editor
function setFocus() {
 textEdit.focus()
}

// Execute a command against the editor
// At minimum one argument is required. Some commands
// require a second optional argument:
// eg., ("formatblock","<H1>") to make an H1

function execCommand(command) {
textEdit.focus()
 if (format=="HTML") {
  var edit = textEdit.document.selection.createRange()
  if (arguments[1]==null)
   edit.execCommand(command)
  else
   edit.execCommand(command,false, arguments[1])
  edit.select()
  textEdit.focus()
 }
}

// Selects all the text in the editor
function selectAllText(){

var edit = textEdit.document;

edit.execCommand('SelectAll');
textEdit.focus();

}

function newDocument() {
	textEdit.document.open()
	textEdit.document.write("")
	textEdit.document.close()
	textEdit.focus()
}

function loadDoc(htmlString) {
	textEdit.document.open()
	textEdit.document.write(htmlString)
	textEdit.document.close()
}
// Initialize the editor with an empty document
function initEditor() {
	var htmlString = parent.document.all.EditorValue.value;
	textEdit.document.designMode="On"
	textEdit.document.open()
	textEdit.document.write(htmlString)
	textEdit.document.close()
	textEdit.focus()
}

// Swap between WYSIWYG mode and raw HTML mode
function swapModes() {
	if (format=="HTML") {
		textEdit.document.body.innerText = textEdit.document.body.innerHTML
		textEdit.document.body.style.fontFamily = "monospace"
		textEdit.document.body.style.fontSize = "10pt"
		format="Text"
 	}
	else {
   		textEdit.document.body.innerHTML = textEdit.document.body.innerText
   		textEdit.document.body.style.fontFamily = ""
   		textEdit.document.body.style.fontSize =""
   		format="HTML"
 	}
	// textEdit.focus()
	var s = textEdit.document.body.createTextRange()
	s.collapse(false)
	s.select()
}

window.onload = initEditor

</SCRIPT>
<!-- Turn off the outer body scrollbars. The IFRAME editbox will display its 
     own scrollbars when necessary -->
[b]<BODY SCROLL=No>[/b]

<IFRAME ID=textEdit>
</IFRAME>
<script>
textEdit.focus();
</script>
</body>
</html>

MVH Jesper

Jesper TMedlem sedan nov. 20017 144 inlägg
#4

Är det för att det är javasript i eller? texten bara försvinner ner i botten när man kommit dit. Det är urbota trist!

MVH Jesper

mozillaMedlem sedan juli 20011 084 inlägg
#5

hmm.. vad är det du vill göra? ändra storlek på scollen eller få bort den? snälla utvecka din fråga.

Jesper TMedlem sedan nov. 20017 144 inlägg
#6

Nu så ser jag att det står:

<!-- Turn off the outer body scrollbars. The IFRAME editbox will display its
own scrollbars when necessary -->

Men det stämmer f-n inte!

MVH Jesper

Jesper TMedlem sedan nov. 20017 144 inlägg
#7

Jag vill kunna scrolla om texten i iframen blir för lång, men det går inte texten bara "försvinner ner" i iframen.

/Jesper

frankofMedlem sedan jan. 20016 874 inlägg
#8

En liten sväng innom w3c ger mig denna länken med lagliga attributer till <iframe>:
http://www.w3.org/TR/html401/present/frames.html#edef-FRAME

Och denna för <body>
http://www.w3.org/TR/html401/struct/global.html#edef-BODY

Så din kod borde bli något såhär:

.........script o tjafs.......
<BODY>

<IFRAME ID="textEdit" scrolling="auto">
</IFRAME>
...resten av dokumentet....

Fast auto är standard så de skall inte behövas.

Jesper TMedlem sedan nov. 20017 144 inlägg
#9

Ok, tack jag upptäckta att det blir scrollist men den kommer inte fram föräns jag har scrollat ner "en hel sida". Konstigt!
Då tar det ju en stund tills man kan läsa texten igen ju! :(
MVH Jesper

Jesper TMedlem sedan nov. 20017 144 inlägg
#10

Ok, det var bara och labba med hight osv. Funkar bra nu!
Tack grabbar!

//Jesper

127 ms totalt · 3 externa anrop · v20260731065814-full.b943c234
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
123 ms — hämta tråd, inlägg och bilagor (db)